Skip to content

feat(doop/landing): trusted checklist read from Multica, inert (CHE-9673) [squash] - #159

Draft
congvc-bot-x99[bot] wants to merge 1 commit into
cheese/mainfrom
agent/x99-claude-sonnet-200k/che-9673-414ec4f68d75
Draft

congvc-bot-x99[bot] wants to merge 1 commit into
cheese/mainfrom
agent/x99-claude-sonnet-200k/che-9673-414ec4f68d75

Conversation

@congvc-bot-x99

Copy link
Copy Markdown

CHE-9673 (S3a of CHE-9448, plan r5). Merges dark: nothing calls trustedChecklist; DOOP_LANDING_WATCHER_ID is a new env key that stays unset; no C00 or production config changes.

What

server/landingChecklist.ts: trustedChecklist(issueId, multica, watcherId, fetchImpl?) returns { ok: true, link, decisionId, pin, text, recordCommentId } or { ok: false, reason }.

  • Reads GET /api/issues/:id/comments?recent=50, no fold param (the CLI sends fold=true by default and omits it with --full; observed against a local stub). Follows X-Multica-Next-Before and X-Multica-Next-Before-Id as before and before_id until a page has no cursor (observed on the real server: a short page has no header, a full page has one). Any error, bad payload, half cursor, repeated cursor, bad created_at or more than 200 pages gives proof_unavailable.
  • Parses with the records.py grammar (tag design-<kind>:<ref>, key: value lines, _dec for quoted values).
  • watcherId unset or empty gives proof_unavailable before Multica is asked.
  • First design-link on the issue, by any author (member included, a stricter reading than records.py, which sees agents only), must be the watcher's, else watcher_mismatch.
  • The watcher's links must name one (canvas, topic), else link_conflict.
  • Latest watcher design-checklist in comment time order is the authority; none gives no_checklist. A malformed latest one gives proof_unavailable, with no fall back to an older one.
  • .env.example and server/env.ts carry DOOP_LANDING_WATCHER_ID (tests/env.test.ts checks the doc).
  • tests/fixtures/design_records_fixtures.txt: S2 fixture from cheese-work/multica-dotfiles @ 40822ddf, byte for byte (1077 bytes, sha256 dc5ecdfc98e6d05fe50d423750cefad757fa49c7251673d46dc3f667228b5fd5).

Test-first

Red, on the base (e21b6250) before any implementation:

$ npx vitest run tests/landingChecklist.test.ts
 FAIL  |parallel| tests/landingChecklist.test.ts [ tests/landingChecklist.test.ts ]
Error: Cannot find module '../server/landingChecklist.ts' imported from .../tests/landingChecklist.test.ts
 Test Files  1 failed (1)
      Tests  no tests

Green, on this head:

$ npx vitest run tests/landingChecklist.test.ts tests/env.test.ts --reporter=verbose
 ✓ trustedChecklist > returns the latest watcher checklist across two pages
 ✓ trustedChecklist > reads the S2 fixture byte for byte
 ✓ trustedChecklist > decodes a quoted multi-line field as records._dec does
 ✓ trustedChecklist > ignores a checklist from another agent
 ✓ trustedChecklist > refuses an unauthorized consistent chain (X link, X checklist) with watcher_mismatch
 ✓ trustedChecklist > refuses a foreign link first, then the watcher link and checklist, with watcher_mismatch
 ✓ trustedChecklist > counts a link by a member as the first link too
 ✓ trustedChecklist > refuses two watcher links on different canvases with link_conflict
 ✓ trustedChecklist > accepts a repeated watcher link for the same canvas and topic
 ✓ trustedChecklist > does not return a superseded checklist
 ✓ trustedChecklist > orders comments by time, not by the order of the pages
 ✓ trustedChecklist > answers no_checklist when the watcher wrote a link but no checklist
 ✓ trustedChecklist > answers no_checklist when the issue has no link at all
 ✓ trustedChecklist > refuses proof_unavailable on a 500 for the first page
 ✓ trustedChecklist > refuses proof_unavailable on a 500 for a later page
 ✓ trustedChecklist > refuses proof_unavailable when a page that the cursor names is missing
 ✓ trustedChecklist > refuses proof_unavailable when the cursor does not move
 ✓ trustedChecklist > refuses proof_unavailable on a half cursor, a bad payload, a network error and a bad timestamp
 ✓ trustedChecklist > refuses proof_unavailable when the watcher id is unset, and does not ask Multica
 ✓ trustedChecklist > refuses proof_unavailable on an unreadable link payload of the watcher
 ✓ env.test.ts (9 tests, incl. documents every declared variable in .env.example)
 Test Files  2 passed (2)
      Tests  29 passed (29)

Also local: bun run typecheck clean, bun run lint PASS (68 s). bun run build not run locally (nothing imports the module); CI runs it.

Self-review

  • Scope: 5 files, all named by the step. No UI change.
  • Secrets: the token is only sent as a bearer header, never logged or returned; no values added to .env.example.
  • Error paths: every read failure maps to proof_unavailable; non-read-failure exceptions are rethrown.
  • Residual risk: pagination assumes the recent=N thread-page contract observed on 26 Nov 2026 ICT; a server that changes it fails closed (cursor errors) or loops out at 200 pages.

…673)

S3a of CHE-9448. trustedChecklist reads every comment page with no folding and
returns the watcher's latest design-checklist, or a refusal. Nothing calls it yet.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants